package com.yzfarm.biujoke.biujoke.mvp.view;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.KeyEvent;

import com.lhh.apst.library.AdvancedPagerSlidingTabStrip;
import com.yzfarm.biujoke.biujoke.R;
import com.yzfarm.biujoke.biujoke.mvp.base.BaseActivity;
import com.yzfarm.biujoke.biujoke.mvp.model.datamanager.RetrofitManager;
import com.yzfarm.biujoke.biujoke.mvp.model.http.MeiNvApis;
import com.yzfarm.biujoke.biujoke.mvp.presenter.MainPresenter;
import com.yzfarm.biujoke.biujoke.ui.adapter.Star12RecyclerAdpter;
import com.yzfarm.biujoke.biujoke.ui.adapter.ViewPagerAdapter;
import com.yzfarm.biujoke.biujoke.utils.pojo.NewMeinvItem;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class MainActivity extends BaseActivity<MainPresenter> {

    /** 页面list **/
    List<Fragment> fragmentList = new ArrayList<Fragment>();
    /** 页面title list **/
    List<String>   titleList    = new ArrayList<String>();
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mToolbar = (Toolbar) findViewById(R.id.toolbar);

        setToolBar(mToolbar,getString(R.string.app_name));
        mToolbar.setNavigationIcon(R.mipmap.ic_launcher);
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_scrolling;
    }

    @Override
    protected void initEventAndData() {

        ViewPager vp = (ViewPager)findViewById(R.id.viewPager);
        fragmentList.add(new PicFragment());
        fragmentList.add(new JokeFragment());
        fragmentList.add(new PicFragment());
        titleList.add("美女");
        titleList.add("笑话");
        titleList.add("小视频");
        vp.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), fragmentList, titleList));
        AdvancedPagerSlidingTabStrip tabs = (AdvancedPagerSlidingTabStrip) findViewById(R.id.tabs);
        tabs.setViewPager(vp);

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public void showError(String msg) {

    }
}
